#include <stdio.h>
#include <sys/types.h>
#include <sys/stat.h>
#include <fcntl.h>
#include <unistd.h>

int main(int argc, char const *argv[])
{
    
    //write(0,"你好,哼哼哼",16);

    // int r = open(argv[1],O_RDONLY);
    // int w = open(argv[2],O_WRONLY|O_CREAT,0666);

    // while (1)
    // {
    //     char buff[36] = "";
    //     int len = read(r,buff,36);
    //     if(len>0)
    //         write(w,buff,len);
    //     else
    //         break;
    // }

    pid_t pid = fork();
    int a=10;
    int* p=&a;
    printf("当前fork的返回值是%d\n",pid);
    if (pid == 0)
    {
        a = 20;
        printf("a的值是:");
        printf("子进程pid是%d\n",getpid());
    }
    else if(pid > 0)
    {
        printf("父进程pid是%d\n",getpid());
        wait(NULL);
    }


    return 0;
}
